package cn.iocoder.yudao.module.ad.dal.mysql.cluelog;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.ad.dal.dataobject.cluelog.AdClueLogDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.ad.controller.admin.cluelog.vo.*;

/**
 * 广告线索记录 Mapper
 *
 * @author 数创万维
 */
@Mapper
public interface AdClueLogMapper extends BaseMapperX<AdClueLogDO> {

    default PageResult<AdClueLogDO> selectPage(AdClueLogPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<AdClueLogDO>()
                .eqIfPresent(AdClueLogDO::getAccountId, reqVO.getAccountId())
                .eqIfPresent(AdClueLogDO::getAdvertiserId, reqVO.getAdvertiserId())
                .likeIfPresent(AdClueLogDO::getAdvertiserName, reqVO.getAdvertiserName())
                .eqIfPresent(AdClueLogDO::getPromotionId, reqVO.getPromotionId())
                .likeIfPresent(AdClueLogDO::getPromotionName, reqVO.getPromotionName())
                .likeIfPresent(AdClueLogDO::getClueName, reqVO.getClueName())
                .betweenIfPresent(AdClueLogDO::getClueCreateTime, reqVO.getClueCreateTime())
                .betweenIfPresent(AdClueLogDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(AdClueLogDO::getId));
    }

}